/*
 * PrimaryMathApp.java
 */
package org.game.math.view;

import org.game.math.view.config.Configure;
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

/**
 * The main class of the application.
 */
class PrimaryMathApp extends SingleFrameApplication {

  /**
   * At startup create and show the main frame of the application.
   */
  override protected def startup(): Unit = {
    show(new PrimaryMathView(this));
  }

  /**
   * This method is to initialize the specified window by injecting resources.
   * Windows shown in our application come fully initialized from the GUI
   * builder, so this additional configuration is not needed.
   */
  override protected def configureWindow(root: java.awt.Window): Unit = {
  }

  override protected def shutdown(): Unit = {
    Configure.getInstance().save();
    super.shutdown();
  }

}
object PrimaryMathApp {
  /**
   * A convenient static getter for the application instance.
   * @return the instance of PrimaryMathApp
   */
  def getApplication(): PrimaryMathApp = {
    Application.getInstance(classOf[PrimaryMathApp]);
  }

  /**
   * Main method launching the application.
   */
  def main(args: Array[String]): Unit = {
    Application.launch(classOf[PrimaryMathApp], args);
  }

}
